package com.lkm.app_ui;

import com.lkm.app_ui.entity.SteelyardExtData;
import com.lkm.app_ui.entity.UserVipOrderInfo;
import com.lkm.app_ui.m.dataUpExt.DataUpExtModule;
import com.lkm.app_ui.m.fun.DelegatePayTask;
import com.lkm.app_ui.m.goods.BarcodeResultBO;
import com.lkm.app_ui.m.vip.VipInfo;
import com.lkm.javatool.StringHelp;
import com.lkm.market2_0.ExpandConfig;
import com.lkm.market2_0.entity.OrganizationInfo;
import com.lkm.market2_0.entity.SteelyardInfo;
import com.lkm.market2_0.m_imple.newDataUp.NewSZApi;
import com.lkm.market2_0.m.steelyarddata.OrderEntity;
import com.lkm.market2_0.m.steelyarddata.SteelyardDataModule;
import com.lkm.market2_0.m.steelyarddata.SteelyardValue;

import java.util.Map;

public class RunTimeData {


    public static boolean DefaultisScanVipFromKeyboard = true;
    


    


    


    
    public static BarcodeResultBO barcodeResultBO;

    

    
    @Deprecated
    public volatile static String ast_oid = "";

    public volatile static OrganizationInfo organizationInfo;

    

    public volatile static SteelyardInfo steelyardInfo;

    

    public volatile static SteelyardValue oldSteelyardValue;

    
    
    public static String LoaclSteelyardMac;

    public volatile static SteelyardExtData steelyardExtData ;



    
    public static OrderEntity orderEntity;
    @DelegatePayTask.PayType
    public static int tmpPayType;

    public static int go2Screen = 60;//跳转 商户显示屏
    public static int go2ScreenOn = 600;// 熄屏时间


    public static Float price;
    

    public static String goodsName;

    
    public static String getStallPayImage(){
        return "";

    }

    

    public static String getAppWeightUnit(){
        if(steelyardInfo==null)return null;
       return StringHelp.isEmpty(steelyardInfo.unit)?"kg":steelyardInfo.unit;
    }

    
    public static boolean isSecondSimulate = false;

    
    public static boolean isSongjian = false;

    

    


    public static boolean isShowGoodsSelect = !true;

    
    public static boolean isNfcDemo = true;

    

    public static boolean isQuickPay = true;

    
    public static boolean isAutoPrint = false;


    
    public static boolean isXIANGCHENG = false;

    
    
    // 台秤状态一有动静就点亮。//收到按钮就亮。就会重新读取到这个值 ，com.lkm.app_ui.m.Imple.fun.FunModuleImple.requestScreenNo
    public static int screenAutoOff = 30 * 60 * 1000;


    public static String printerMode = "";

    public static String serialport = "0";


    

    public static boolean isPrint_vip(){
        return orderPrintTemplate.contains("${vip_");
    }
    // 最后一个支付成功的会员 见 com.lkm.app_ui.ui.PayFragment。然后给VipOrderFixFragment使用
    public static VipInfo lastPayOKvipInfo;
    public static UserVipOrderInfo PrintVipOrderInfo;
    

    public static String orderPrintTemplate = "{\"sp\":\"-\"}\n" +
            "市场：${orgName}\n" +
            "档口号：${stallName}\n" +
            "卖家名称：${name}\n" +
            "卖家电话：${phone}\n" +
            "秤号：${bid}\n" +
            "溯源编码：${orderId}\n" +
            "if(${isSalesReturn})\n" +
            "退货时间：${addTime}\n" +
            "if(!${isSalesReturn})\n" +
            "交易时间：${addTime}\n" +
            "[Line]${sp}\n" +
            "if(${hasGoodWeights})\n" +
            "${goodWeights}\n" +
            "if(${hasGoodNums})\n" +
            "${goodNums}\n" +
            "合计${padding}${allPrice}元\n" +
            "实付${padding}${oe_payment_amount}元\n" +
            "[L_center]${qrStr}\n" +
            "[QR]${qr_url}";
    

    public static void setSZHost(String szHost){
        NewSZApi.setHost(szHost);

        DataUpExtModule dataUpExtModule = DataUpExtModule.getInstance();
        if (dataUpExtModule != null) {
            dataUpExtModule.setHost(szHost);
        }

    }

    

    public static SteelyardValue getSteelyardValue() {

        SteelyardDataModule mSteelyardDataModule = ExpandConfig.instance.getModuleManager().loadModule(SteelyardDataModule.class);
        SteelyardValue steelyardValue = mSteelyardDataModule == null ? null : mSteelyardDataModule.getSteelyardValue(RunTimeData.steelyardInfo.getSteelyardMac());
        if (steelyardValue == null) {
            steelyardValue = oldSteelyardValue;
        }
        return steelyardValue;
    }
}
